package entitybeans;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity(name = "PlanoSaude")
@Table(name = "TB_PLAN_SAUD")
public class PlanoSaudeEntity {
	@Id
	@Column(name = "CD_PLAN_SAUD")
	private int id;
	@Column(name = "NM_PLAN_SAUD")
	private String nome;
	@ManyToOne
	@JoinColumn(name = "CD_CONV_MEDI")
	private ConvenioEntity convenio;
	@Transient
	private List<MedicoPlanoEntity> medicosPlanos;

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		result = prime * result + ((nome == null) ? 0 : nome.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PlanoSaudeEntity other = (PlanoSaudeEntity) obj;
		if (id != other.id)
			return false;
		if (nome == null) {
			if (other.nome != null)
				return false;
		} else if (!nome.equals(other.nome))
			return false;
		return true;
	}

	public List<MedicoPlanoEntity> getMedicosPlanos() {
		return medicosPlanos;
	}

	public void setMedicosPlanos(List<MedicoPlanoEntity> medicosPlanos) {
		this.medicosPlanos = medicosPlanos;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public ConvenioEntity getConvenio() {
		return convenio;
	}

	public void setConvenio(ConvenioEntity convenio) {
		this.convenio = convenio;
	}

}
